View Javadoc

1   // ELFConstants.java, created Sat May 25 12:46:16 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Linker.ELF;
5   
6   /***
7    *
8    * @author  John Whaley <jwhaley@alum.mit.edu>
9    * @version $Id: ELFConstants.java 1451 2004-03-09 06:27:08Z jwhaley $
10   */
11  public interface ELFConstants {
12  
13      byte ELFMAG0    = (byte)0x7f;
14      byte ELFMAG1    = (byte)'E';
15      byte ELFMAG2    = (byte)'L';
16      byte ELFMAG3    = (byte)'F';
17      
18      // ei_class
19      byte ELFCLASSNONE   = (byte)0;
20      byte ELFCLASS32     = (byte)1;
21      byte ELFCLASS64     = (byte)2;
22      
23      // ei_data
24      byte ELFDATANONE   = (byte)0;
25      byte ELFDATA2LSB   = (byte)1;
26      byte ELFDATA2MSB   = (byte)2;
27      
28      // e_type
29      int ET_NONE     = 0;
30      int ET_REL      = 1;
31      int ET_EXEC     = 2;
32      int ET_DYN      = 3;
33      int ET_CORE     = 4;
34      int ET_LOPROC   = 0xff00;
35      int ET_HIPROC   = 0xffff;
36  
37      // e_machine
38      int EM_M32      = 1;
39      int EM_SPARC    = 2;
40      int EM_386      = 3;
41      int EM_68K      = 4;
42      int EM_88K      = 5;
43      int EM_860      = 7;
44      int EM_MIPS     = 8;
45      int EM_MIPS_RS4_BE = 10;
46      
47      // e_version
48      int EV_NONE       = (byte)0;
49      int EV_CURRENT    = (byte)1;
50      
51      // Segment Types
52      int PT_NULL     = 0;
53      int PT_LOAD     = 1;
54      int PT_DYNAMIC  = 2;
55      int PT_INTERP   = 3;
56      int PT_NOTE     = 4;
57      int PT_SHLIB    = 5;
58      int PT_PHDR     = 6;
59      int PT_LOPROC   = 0x70000000;
60      int PT_HIPROC   = 0x7fffffff;
61  
62      // Reloc Types
63      byte R_386_NONE = 0;
64      byte R_386_32   = 1;
65      byte R_386_PC32 = 2;
66      
67      // Special Section Indexes
68      int SHN_UNDEF       = 0;
69      int SHN_LORESERVE   = 0xff00;
70      int SHN_LOPROC      = 0xff00;
71      int SHN_HIPROC      = 0xff1f;
72      int SHN_ABS         = 0xfff1;
73      int SHN_COMMON      = 0xfff2;
74      int SHN_HIRESERVE   = 0xffff;
75      int SHN_INVALID     = -1;
76      
77      // Section Types.
78      int SHT_NULL        = 0;
79      int SHT_PROGBITS    = 1;
80      int SHT_SYMTAB      = 2;
81      int SHT_STRTAB      = 3;
82      int SHT_RELA        = 4;
83      int SHT_HASH        = 5;
84      int SHT_DYNAMIC     = 6;
85      int SHT_NOTE        = 7;
86      int SHT_NOBITS      = 8;
87      int SHT_REL         = 9;
88      int SHT_SHLIB       = 10;
89      int SHT_DYNSYM      = 11;
90      int SHT_LOPROC      = 0x70000000;
91      int SHT_HIPROC      = 0x7fffffff;
92      int SHT_LOUSER      = 0x80000000;
93      int SHT_HIUSER      = 0xffffffff;
94      
95      // Section Attribute Flags
96      int SHF_WRITE       = 0x1;
97      int SHF_ALLOC       = 0x2;
98      int SHF_EXECINSTR   = 0x4;
99      int SHF_MASKPROC    = 0xf0000000;
100     
101     // Symbol Binding
102     byte STB_LOCAL   = 0;
103     byte STB_GLOBAL  = 1;
104     byte STB_WEAK    = 2;
105     byte STB_LOPROC  = 13;
106     byte STB_HIPROC  = 15;
107     
108     // Symbol Types
109     byte STT_NOTYPE  = 0;
110     byte STT_OBJECT  = 1;
111     byte STT_FUNC    = 2;
112     byte STT_SECTION = 3;
113     byte STT_FILE    = 4;
114     byte STT_LOPROC  = 13;
115     byte STT_HIPROC  = 15;
116     
117 }